#include <iostream>
#include <list>
#include <string>

struct test
{
    int n;
    int b;
};
void fun (test *t)
{
    t->n = 10;
}
void foo (int **p)
{
    (*p)[1] = 20;
}
std::list<int> nlist;
int last_n = 0;
int gen_id ()
{
    if (nlist.empty ())
	for (int i = last_n + 1; i < last_n + 16; ++i)
	    nlist.push_back (i);
    last_n = nlist.front ();
    nlist.pop_front ();
    return last_n;
}
int main ()
{
    int rset = 10;
    int wset;

    std::cout << *(&(wset = rset)) << std::endl;
    test tt;
    tt.n = 20;
    tt.b = 20;
    fun (&tt);
    std::cout << tt.n << std::endl;

    std::string str("192.168.1.49:21");
    size_t pos = str.rfind (':');
    std::cout << str.substr (pos+1);
    std::cout << str.substr (0, pos);

    int *buff = new int[20];
    buff[1] = 0;
    foo(&buff);
    std::cout << buff[1] << std::endl;

    for (int i = 0; i < 90; ++i)
    {
	std::cout << gen_id () << std::endl;
    }
#ifdef __linux__
    std::cout << "linux\n" << std::endl;
#endif
    return 0;
}
